←Select platform

ReadFrames(RasterCodecs,string,List<int>,int,CodecsLoadByteOrder) Method

Summary

Loads the specified frame images (i.e. CompositeJpxImages.ColorImage, CompositeJpxImages.OpacityImage, and CompositeJpxImages.PreOpacityImage) from the specified JPEG 2000 file using the specified options.

Syntax

C#
VB
C++
public List<CompositeJpxImages> ReadFrames( 
   RasterCodecs codecs, 
   string fileName, 
   List<int> frames, 
   int bitsPerPixel, 
   CodecsLoadByteOrder order 
) 
  
Public Overloads Function ReadFrames( _ 
   ByVal codecs As Leadtools.Codecs.RasterCodecs, _ 
   ByVal fileName As String, _ 
   ByVal frames As List(Of Integer), _ 
   ByVal bitsPerPixel As Integer, _ 
   ByVal order As Leadtools.Codecs.CodecsLoadByteOrder _ 
) As List(Of CompositeJpxImages) 
public: 
List<CompositeJpxImages^>^ ReadFrames(  
   Leadtools.Codecs.RasterCodecs^ codecs, 
   String^ fileName, 
   List<int>^ frames, 
   int bitsPerPixel, 
   Leadtools.Codecs.CodecsLoadByteOrder order 
)  

Parameters

codecs
The Leadtools.Codecs.RasterCodecs object.

fileName
System.String containing the name of the JPEG 2000 image file which has the frames being loaded.

frames
Frame indices. A list of integers specifying the indices of the frames to be loaded from the file.

bitsPerPixel
Resulting image pixel depth. If this value is zero [0], the image will have the original file's pixel depth (the image will not be converted).

order
Color order for 16-bit, 24-bit, 32-bit, 48-bit, and 64-bit images. If the resulting image is less than 16 bits per pixel, this will have no effect since palletized images do not use color order. Valid values are as follows:

Value Meaning
CodecsLoadByteOrder.Rgb Red, green, and blue color order in memory
CodecsLoadByteOrder.Bgr Blue, green, and red color order in memory
CodecsLoadByteOrder.Gray 12-bit or 16-bit grayscale image. 12-bit and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.RgbOrGray Load the image as red, green, blue OR as a 12-bit or 16-bit grayscale image. 12-bit and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.BgrOrGray Load the image as blue, green, red OR as a 12-bit or 16-bit grayscale image. 12-bit and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.Romm ROMM order. ROMM only supports 24-bit and 48-bit images.
CodecsLoadByteOrder.BgrOrGrayOrRomm Load the image as red, green, blue OR as a 12-bit or 16-bit grayscale image OR as ROMM. 12-bit and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. ROMM only supports 24-bit and 48-bit color images.

Return Value

The CompositeJpxImages list that this method loads.

Remarks

All engine boxes will be reset.

Example

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Jpeg2000; 
 
public void ReadFramesStringExample() 
{ 
   // Load a JPEG 2000 image 
   Jpeg2000Engine engine = new Jpeg2000Engine(); 
   Jpeg2000FileInformation fileInfo = engine.GetFileInformation(Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx")); 
   if (fileInfo.Frame.GetLength(0) < 2) 
      return; 
 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   List<int> frames = new List<int>(); 
   frames.Add(1); 
   List<CompositeJpxImages> images = engine.ReadFrames(codecs, Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx"), frames, 0, CodecsLoadByteOrder.BgrOrGray); 
   // Clean up 
   foreach (CompositeJpxImages image in images) 
   { 
      if (image.ColorImage != null) 
         image.ColorImage.Dispose(); 
 
      if (image.OpacityImage != null) 
         image.OpacityImage.Dispose(); 
 
      if (image.PreOpacityImage != null) 
         image.PreOpacityImage.Dispose(); 
   } 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Jpeg2000 
 
Public Sub ReadFramesStringExample() 
   ' Load a JPEG 2000 image 
   Dim engine As New Jpeg2000Engine() 
   Dim fileInfo As Jpeg2000FileInformation = engine.GetFileInformation(Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx")) 
   If (fileInfo.Frame.GetLength(0) < 2) Then 
      Return 
   End If 
 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
   Dim frames As New List(Of Integer) 
   frames.Add(1) 
   Dim images As List(Of CompositeJpxImages) = engine.ReadFrames(codecs, Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx"), frames, 0, CodecsLoadByteOrder.BgrOrGray) 
 
   '  Clean up 
   Dim _image As CompositeJpxImages 
   For Each _image In images 
      If Not _image.ColorImage Is Nothing Then 
         _image.ColorImage.Dispose() 
      End If 
 
      If Not _image.OpacityImage Is Nothing Then 
         _image.OpacityImage.Dispose() 
      End If 
 
      If Not _image.PreOpacityImage Is Nothing Then 
         _image.PreOpacityImage.Dispose() 
      End If 
   Next _image 
   codecs.Dispose() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Jpeg2000 Assembly